from django.db import models

# Create your models here.
# 用户表
class UserModel(models.Model):
    username = models.CharField(max_length=45)
    password = models.CharField(max_length=50)
    # 权限默认没有权限
    admin = models.BooleanField(default=False)
    class Meta:
        verbose_name ='用户表'
        verbose_name_plural =verbose_name
# 订单表
class OrderModel(models.Model):
    ding_name = models.CharField(max_length=50)
    phone = models.CharField(max_length=11)
    product = models.ForeignKey('Products',on_delete=models.CASCADE)
    user = models.ForeignKey('UserModel',on_delete=models.CASCADE)
    class Meta:
        verbose_name ='订单表'
        verbose_name_plural =verbose_name

class Products(models.Model):
    goods_name = models.CharField(max_length=250)
    goods_img = models.ImageField(upload_to='static/img')
    goods_price = models.DecimalField(max_digits=8,decimal_places=2)
    admin_price = models.DecimalField(max_digits=8,decimal_places=2)
    class Meta:
        verbose_name ='产品表'
        verbose_name_plural =verbose_name